package io.xxx.xbutler.domain.task;

import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.xxx.xbutler.constant.Formats;
import lombok.Data;
import org.apache.ibatis.type.EnumTypeHandler;

import java.time.LocalDateTime;

@Data
public class TaskTemplateItem {

    @TableId
    private Long id;

    private Long templateId;

    /**
     * 从0开始，消息组内序号
     */
    private Integer sn;

    private Integer psn;

    @TableField(typeHandler = EnumTypeHandler.class)
    private MessageType messageType;

    @TableField(typeHandler = EnumTypeHandler.class)
    private ContentType contentType;

    @TableField(typeHandler = Fastjson2TypeHandler.class)
    private JSONObject content;

    @JsonFormat(pattern = Formats.DATETIME_FORMAT)
    private LocalDateTime createdTime;
}
